class Solution {
public:
    int lengthOfLongestSubstring(string s) {
        int m=s.size();
        int hash[128]={0};
        int ret=0;
        int left=0,right=0;
       while(right<m)
       {
          hash[s[right]]++;
          while(hash[s[right]]>1)
          {
            hash[s[left++]]--;
          }
          ret=max(ret,right-left+1);
          right++;
       }
       return ret;
        
        
    }
};